package com.financing.wap.dao.impl;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.financing.wap.common.SqlName;
import com.financing.wap.dao.IPaymentDao;
import com.financing.wap.dto.FpPaymentDTO;



@Repository("paymentDaoImpl")
public class PaymentDaoImpl extends BaseDaoImpl<FpPaymentDTO, java.lang.Integer> implements IPaymentDao {


	@Override
	public Class<FpPaymentDTO> getEntityClass() {
		return FpPaymentDTO.class;
	}

	@SuppressWarnings("deprecation")
	@Override
	public int insertPayment(FpPaymentDTO paymentDTO) throws SQLException {
		return (Integer)this.sqlMapClientTemplate.insert(SqlName.PaymentSql.addPayment, paymentDTO);
	}

	@SuppressWarnings("deprecation")
	@Override
	public FpPaymentDTO loadByOrderId(Map<String,String> map) throws SQLException {
		return (FpPaymentDTO)this.sqlMapClientTemplate.queryForObject(SqlName.PaymentSql.queryPayment, map);
	}

	@SuppressWarnings("deprecation")
	@Override
	public void updatePayment(FpPaymentDTO paymentUp) throws SQLException {
		this.sqlMapClientTemplate.update(SqlName.PaymentSql.updatePayment, paymentUp);
	}

	@SuppressWarnings({ "unchecked", "deprecation" })
	@Override
	public List<FpPaymentDTO> queryPaymentList(Map<String, String> map)
			throws SQLException {
		return this.sqlMapClientTemplate.queryForList(SqlName.PaymentSql.queryPaymentList, map);
	}

	@SuppressWarnings("deprecation")
	@Override
	public int queryPaymentListCount(Map<String, String> map) {
		return (Integer) this.sqlMapClientTemplate.queryForObject(SqlName.PaymentSql.queryPaymentListCount, map);
	}

}
